var events = require('events')
var emitter = new  events.EventEmitter();

/*注册事件*/
emitter.on('event1',function () {
   console.log('this is the event1');
})

emitter.on('event2',function () {
    console.log('this is the event2');

    emitter.emit('event1');
})

emitter.on('event3',function (message) {
    console.log('this is the event3');
    console.log("message:"+ message)
})

/*激活事件*/
emitter.emit('event1')
emitter.emit('event2')
emitter.emit('event3','hello')

/*
 * vue
 *   on ---  触发事件
 *   emit-- 分发事件（注册）
* */
